<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        #app {
            width: 200px;
            height: 200px;
            background-color: cornflowerblue;
        }
    </style>
</head>

<body>
    <div id="app"></div>
</body>

<script>
    var app = document.querySelector('#app');
    console.log(app);
    // 给指定元素添加 点击事件监听

    app.onclick = function() {
        console.log('app 被点击了');
    }

    app.oncontextmenu =  function() {
        console.log('app 被右键点击了');
    }
</script>
</html>